package com.gxy.learn.design.model.construction.combination;

/**
 * @description: 菜单组件 抽象根节点
 * @author: gaoxueyong
 * @Date: 2022/11/7 21:33
 */
public abstract class MenuComponent {
    //    名称
    protected String name;
    //    层级
    protected int level;

    public MenuComponent(String name, int level) {
        this.name = name;
        this.level = level;
    }

    /**
     * 添加子菜单
     *
     * @return void
     * @Author gaoxueyong
     * @Date 9:35 下午 2022/11/7
     * @Param [menuComponent]
     **/
    public void add(MenuComponent menuComponent) {
        throw new UnsupportedOperationException();
    }

    /**
     * 移除子菜单
     *
     * @return void
     * @Author gaoxueyong
     * @Date 9:35 下午 2022/11/7
     * @Param [menuComponent]
     **/
    public void remove(MenuComponent menuComponent) {
        throw new UnsupportedOperationException();
    }

    /**
     * 获取指定菜单
     *
     * @return com.gxy.learn.design.model.construction.combination.MenuComponent
     * @Author gaoxueyong
     * @Date 9:38 下午 2022/11/7
     * @Param [index]
     **/
    public MenuComponent getChild(int index) {
        throw new UnsupportedOperationException();
    }

    /**
     * 获取菜单、菜单项名称
     *
     * @return java.lang.String
     * @Author gaoxueyong
     * @Date 9:38 下午 2022/11/7
     * @Param []
     **/
    public String getName() {
        return name;
    }

    /**
     * 打印菜单名称方法（包含子菜单和子菜单项）
     *
     * @return void
     * @Author gaoxueyong
     * @Date 9:39 下午 2022/11/7
     * @Param []
     **/
    public abstract void print();
}
